/**
 * @file draw.h
 * @author 范文宇 (2643660853@qq.com)
 * @brief
 * @version 1.0
 * @date 2022-10-21
 *
 * @copyright Copyright (c) 2022
 *
 */
#pragma once

#include <iostream>
#include <vector>

#include <opencv2/opencv.hpp>

#include "drawparameter.h"

class Draw
{
public:
    int _img_height;
    int _img_width;
    int _point_height;
    int _point_width;
    int _point_size;

    cv::Scalar _background_color;
    cv::Scalar _line_color;
    cv::Scalar _obstacle_color;
    cv::Scalar _startpoint_color;
    cv::Scalar _endpoint_color;
    cv::Scalar _path_color;

    bool _ifSetObstacle;			   
	bool _ifSetStartingPoint;		   
	bool _ifSetFinishingPoint;		   
	bool _ifGetPath;				   



    void DrawBackground(cv::Mat &img);
    void DrawObstacle(cv::Mat &img, std::vector<cv::Point2i> *obstacle, int sizeOfObstacle);
    void DrawStartingPoint(cv::Mat &img, cv::Point2i startingPoint);
    void DrawFinishingPoint(cv::Mat &img, cv::Point2i finishingPoint);
    void DrawPath(cv::Mat &img, std::vector<int> *shortestPath, int sizeOfPath);
    void DrawImg(cv::Mat &img,
                 std::vector<cv::Point2i> *obstacle = nullptr, int sizeOfObstacle = 0,
                 cv::Point2i startingPoint = cv::Point2i(0, 0),
                 cv::Point2i finishingPoint = cv::Point2i(0, 0),
                 std::vector<int> *shortestPath = nullptr, int sizeOfPath = 0);
    cv::Mat createImg();
    // 构造函数
	Draw(int point_width, int point_height);
	// 析构函数
	~Draw() = default;
	// 输出绘制图像信息
    // 获取图像高度
	inline int getImgHeight() { return _img_height; }
	// 获取图像宽度
	inline int getImgWidth() { return _img_width; }
	// 获取点直径
	inline int getPointSize() { return _point_size; }
	// 设置起点标志位
	inline void setIfSetStartingPoint(bool state) { _ifSetStartingPoint = state; }
	// 设置终点标志位
	inline void setIfSetFinishingPoint(bool state) { _ifSetFinishingPoint = state; }
	// 设置障碍物标志位
	inline void setIfSetObstacle(bool state) { _ifSetObstacle = state; }
	// 设置最短路径获取标志位
	inline void setIfGetPath(bool state) { _ifGetPath = state; }
};